//
//  Car.m
//  InstancetypeDemo
//
//  Created by UniHan_iMac on 17/3/29.
//  Copyright © 2017年 UniHan_iMac. All rights reserved.
//

#import "Car.h"

@implementation Car
// dispatch_once 创建单例类
+ (instancetype)sharedCar
{
    static Car *car = nil;
    static dispatch_once_t token;
    dispatch_once(&token, ^{
        car = [[self alloc] init];
    });
    return car;
}
+ (id)allocWithZone:(struct _NSZone *)zone
{
    static Car *car = nil;
    static dispatch_once_t token;
    dispatch_once(&token, ^{
        car = [super allocWithZone:zone];
    });
    return car;
}
@end
